import Vue from "vue";
import VueRouter from "vue-router";
import LoginView from "../views/login/LoginView";
import LayoutView from "../views/layout/LayoutView";
import SiteAction from "../views/site/action/SiteAction";
import CategoryView from "../views/product/category/CategoryView";
import ProductListView from "../views/product/list/ProductListView";
import ProductEditView from "../views/product/edit/ProductEditView";
import Dashboard from "../views/Dashboard";

Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    name: "Login",
    component: LoginView,
    meta: {
      titlt: "登录",
    },
  },
  {
    path: "/",
    name: "Home",
    component: LayoutView,
    redirect: "/dashboard",
    children: [
      {
        path: "/dashboard",
        name: "Dashboard",
        component: Dashboard,
        meta: {
          titlt: "首页",
        },
      },
    ],
  },
  {
    path: "/site",
    name: "Site",
    component: LayoutView,
    meta: {
      titlt: "网站设置",
    },
    children: [
      {
        path: "/site/action",
        name: "SiteAction",
        component: SiteAction,
        meta: {
          title: "用户操作",
        },
      },
      // {
      //   path: "/site/aside",
      //   name: "SiteAside",
      //   component: "",
      //   meta: {
      //     titlt: "侧边栏设置",
      //   },
      // },
    ],
  },
  {
    path: "/product",
    name: "Product",
    component: LayoutView,
    meta: {
      title: "商品管理",
    },
    children: [
      {
        path: "/product/category",
        name: "ProductCategory",
        component: CategoryView,
        meta: {
          title: "商品分类",
        },
      },
      {
        path: "/product/list",
        name: "ProductList",
        component: ProductListView,
        meta: {
          title: "商品列表",
        },
      },
      {
        path: "/product/create",
        name: "ProductCreate",
        component: ProductEditView,
        meta: {
          title: "创建商品",
        },
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
